﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ObjectMessage : MonoBehaviour
{
    public int id;//物品在总仓库的id号
    public int kinds;//物品所属种类，0为装备，1为技能
    public Image image;//图片
    public Text text;//数量或者等级

    public void FindBombBox()
    {
        if (kinds == 0 && this.gameObject.GetComponent<Toggle>().isOn)
        {
            CarryOnBagManager.COBM.idd = id;
            MainItem mainItem = CarryOnBagManager.COBM.mainItem;
            GameObject a = CarryOnBagManager.COBM.bombBox;
            a.SetActive(true);
            GameObject b = a.transform.GetChild(0).GetChild(0).gameObject;
            int itemCategory = mainItem.itemList[id].itemCategory;
            //Image
            b.transform.GetChild(0).GetComponent<Image>().sprite = mainItem.itemList[id].itemImage;
            //name
            b.transform.GetChild(1).GetComponent<Text>().text = mainItem.itemList[id].itemName;
            //grade
            b.transform.GetChild(2).GetComponent<Text>().text = "+" + mainItem.itemList[id].itemGrade;
            //attribute
            b.transform.GetChild(3).GetComponent<Text>().text = VariableDocument.GetInstance.equipmentAddText[itemCategory, 0] + ":" + mainItem.itemList[id].attribute[VariableDocument.GetInstance.equipmentAddIndex[itemCategory, 0]] + "\n" +
                VariableDocument.GetInstance.equipmentAddText[itemCategory, 1] + ":" + mainItem.itemList[id].attribute[VariableDocument.GetInstance.equipmentAddIndex[itemCategory, 1]];
            //价值
            b.transform.GetChild(4).GetComponent<Text>().text = "价值:       " + ((mainItem.itemList[id].itemGrade + 1) * 15);
        }
    }
    
}
